//
//  ConsumptionDetailsView.m
//  SameWorld(merchant)
//
//  Created by 杨旭 on 2017/4/9.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "ConsumptionDetailsView.h"
#import "ScanningModel.h"
@interface ConsumptionDetailsView ()

@property (nonatomic ,strong) ScanningModel *model;

/** 订单详情*/
@property (weak, nonatomic) IBOutlet UIView *orderDetailsView;

//** 确认消费按钮*/
@property (weak, nonatomic) IBOutlet UIButton *confirmBtn;
//** 取消消费按钮*/
@property (weak, nonatomic) IBOutlet UIButton *cancelBtn;

//** 标题*/
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
//** 订单编号*/
@property (weak, nonatomic) IBOutlet UILabel *order_idLabel;
//** 付款方式*/
@property (weak, nonatomic) IBOutlet UILabel *pay_typeLabel;
//** 时间*/
@property (weak, nonatomic) IBOutlet UILabel *user_sjLabel;
//** 实付款*/
@property (weak, nonatomic) IBOutlet UILabel *actual_jeLabel;
//** 密码*/
@property (weak, nonatomic) IBOutlet UILabel *keyLabel;

@property (nonatomic ,strong) NSString *key;
@end

@implementation ConsumptionDetailsView

- (instancetype)initWithFrame:(CGRect)frame withScannimg:(ScanningModel *)model withKeySecret:(NSString *)key
{
    self = [super initWithFrame:frame];
    if (self) {
        NSArray *viewArray = [[NSBundle mainBundle] loadNibNamed:@"ConsumptionDetailsView" owner:self options:nil];
        self = viewArray[0];
        self.frame =frame;
        self.backgroundColor = [UIColor colorWithHexString:@"#f2f2f2"];
        self.model = model;
        self.key = key;
        [self setupUI];
        [self setData];
    }
    return self;
}

- (void)setupUI {
    
    // 设置边框
    self.orderDetailsView.layer.borderWidth = 1.0f;
    self.orderDetailsView.layer.borderColor = [UIColor colorWithHexString:@"#dddddd"].CGColor;
    
    // 设置圆角
    self.confirmBtn.layer.masksToBounds = YES;
    self.confirmBtn.layer.cornerRadius = 5.0f;
    self.cancelBtn.layer.masksToBounds = YES;
    self.cancelBtn.layer.cornerRadius = 5.0f;
    
    self.confirmBtn.hidden = YES;
    self.cancelBtn.hidden = YES;
    
}

- (void)setData {

    _titleLabel.text = self.model.data_commodity[@"titile"];
    _order_idLabel.text = self.model.order_id;
    _actual_jeLabel.text = self.model.actual_je;
    _pay_typeLabel.text = self.model.pay_type;
    _user_sjLabel.text = self.model.user_sj;
    _keyLabel.text = self.key;
}

#pragma mark - 确认消费按钮点击
- (IBAction)confirmBtnClick:(UIButton *)sender {
}
#pragma mark - 取消消费按钮点击
- (IBAction)cancelBtnClick:(UIButton *)sender {
}

@end
